<?php

namespace zhtfrontend\models\datas;

use Yii;
use yii\behaviors\TimestampBehavior;
use yii\db\ActiveRecord;
use yii\helpers\ArrayHelper;

/**
 * This is the model class for table "{{%settlement_voucher}}".
 *
 * @property integer $settlement_id
 * @property string $voucher_url
 * @property string $operator
 * @property integer $operator_id
 * @property integer $created_at
 */
class SettlementVoucher extends \zhtfrontend\components\bases\BaseModel
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%settlement_voucher}}';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['settlement_id', 'operator_id', 'created_at'], 'integer'],
            [['voucher_url'], 'string', 'max' => 255],
            [['operator'], 'string', 'max' => 50],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'settlement_id' => Yii::t('zhtfrontend', '发卡人id'),
            'voucher_url' => Yii::t('zhtfrontend', '凭证url'),
            'operator' => Yii::t('zhtfrontend', '操作人'),
            'operator_id' => Yii::t('zhtfrontend', '操作人id'),
            'created_at' => Yii::t('zhtfrontend', '创建时间'),
            'status' => Yii::t('zhtfrontend', '付款状态'),
        ];
    }

    public function behaviors()
    {
        return ArrayHelper::merge(parent::behaviors(), [
            [
                'class' => TimestampBehavior::className(),
                'attributes' => [
                    ActiveRecord::EVENT_BEFORE_INSERT => ['created_at'],
                ],
            ],
        ]);
    }

}
